package com.ele.Servlet;

import com.ele.Service.impl.EmployeeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
//删除emp
@WebServlet("/delete")
public class DeleteServlet extends HttpServlet {
    //创建对象
    EmployeeServiceImpl employeeService = new EmployeeServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String id =req.getParameter("id");

        // 如果没有传递id，就不用继续执行
        if(id == null || id.trim().equals("")){
            resp.getWriter().write("id不能为空");
            return ;
        }
        int x=employeeService.deleteEmp(id);

        resp.getWriter().write(x+"");

    }
}
